<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <?php include_http_metas() ?>
        <?php include_metas() ?>
        <?php include_title() ?>
        <link rel="shortcut icon" href="/favicon.ico" />
        <?php include_stylesheets() ?>
        <?php include_javascripts() ?>
    </head>
    <body>
        <script type="text/javascript">
            $(function(){
                $('#content').hide();
            })

            $('document').ready(function(){
                $('#loader').hide();
                $('#content').show();
            })

        </script>
        <div id="conteneur">
            <?php include_component('sfAdminDash','header'); ?>
            <div id="loader">
                <img src="/images/loader.gif" alt="Chargement..." />
                <br />
                Chargement...
            </div>

            <div id="content" style="display: none;">
                <?php echo $sf_content ?>
            </div>
            <?php if(!strpos($sf_request->getUri(), 'contact')) { ?>
            <div>
                    <?php include_partial('sfAdminDash/footer'); ?>
            </div>
                <?php } ?>
        </div>

        <!-- Affichage du calendrier latéral si on n'est pas sur l'index  -->
        <?php if($sf_request->getUri() != 'http://'. $_SERVER['SERVER_NAME'] .'/'
                && $sf_request->getUri() != 'http://'. $_SERVER['SERVER_NAME'] .'/index.php'
                && $sf_request->getUri() != 'http://'. $_SERVER['SERVER_NAME'] .'/index.php/'
                && $sf_request->getUri() != 'http://'. $_SERVER['SERVER_NAME'] .'/CRM_dev.php'
                && $sf_request->getUri() != 'http://'. $_SERVER['SERVER_NAME'] .'/CRM_dev.php/'
                && $sf_user->isAuthenticated()
        ) { ?>

        <div id="bouton_agenda">
            <div style="float: left;">
                <h3 class="ui-widget-header ui-corner-all" style="font-size: 16px;"><a href="#" id="button">Agenda</a></h3>
            </div>
        </div>
        <script type="text/javascript">
            $(function() {
                //run the currently selected effect
                var firstClick = true;
                var shown = false;
                function toggleAgenda(){
                    if(firstClick == true){
                        //                        $('#mini_agenda').css('visibility', 'visible');
                        //                        $('#mini_agenda').css('display', 'none');
                        $('#mini_agenda').load('<?php echo url_for('agenda/render') ?>');
                        firstClick = false;
                    }
                    //run the effect
                    if(shown == true){
                        $("#mini_agenda").hide();
                        shown = false;
                    }else{
                        $("#mini_agenda").show();
                        shown = true;
                    }
                };

                $("#bouton_agenda").click(function() {
                    toggleAgenda();
                    return false;
                });

                $('#conteneur').click(function(){
                    if(shown == true){
                        toggleAgenda();
                    }
                })


            });
        </script>

        <div id="mini_agenda">
        </div>
            <?php } ?>
    </body>
</html>
